package com.beemans.common.utils

import android.content.Context
import me.jessyan.autosize.AutoSize
import me.jessyan.autosize.AutoSizeConfig
import me.jessyan.autosize.unit.Subunits
import me.jessyan.autosize.unit.UnitsManager

/**
 * @author tiamosu
 * @date 2021/3/13
 *
 * 描述：屏幕适配方案
 */
object AutoSize {
    const val DESIGN_WIDTH = 375f
    const val DESIGN_HEIGHT = 812f

    /**
     * 初始化
     */
    fun init(context: Context, manger: UnitsManager.() -> Unit = {}) {
        //多进程适配
        AutoSize.initCompatMultiProcess(context)

        AutoSizeConfig.getInstance().unitsManager?.apply {
            isSupportDP = false
            isSupportSP = false
            supportSubunits = Subunits.PT
            setDesignSize(DESIGN_WIDTH, DESIGN_HEIGHT)

            apply(manger)
        }
    }
}